(function() {
	App.set("$Event.user.main.user_login_out", function() {
		coAjax.get(appConfig.user.login_out_url, function() {
			App.set("loginer", null);
			if (_isWX) {
				globalSet("WEIXIN_OPENID", "");
			};
			Path.jump("/main.html");
			alert("warn", "您已退出登陆！！！");
		});
	});
	App.set("$Event.user.main.jumpToLogin", function() {
		myConfirm("您还未登陆，请先登陆", function() {
			Path.jump("/sign_in.html");
		});
	});
	App.set("$Event.user.main.show_location_store_share", function() {
		App.model.toggle("$Cache.user.main.show_location_store_share");
	});
	Path.on("/__basename__.html", function(_current_location) {
		//微信绑定
		globalGet("WEIXIN_OPENID", function(openid) {
			App.set("$Cache.user.main.WX.openid", openid);
			App.set("$Event.user.main.bind_weixin_by_openid", function() {
				coAjax.put(appConfig.user.bind_weixin_account_by_open_id, {
					openid: openid
				}, function(result) {
					App.set("loginer", result.result);
					alert("success", "微信号绑定成功，下次无需手动登录");
				});
			});
		});
	});
}());